package com.kelvem.saas.workbanch.ontology.order.controller;

import com.kelvem.saas.workbanch.core.base.BaseController;
import com.kelvem.saas.workbanch.ontology.order.enums.OrderEventEnum;
import com.kelvem.saas.workbanch.ontology.order.model.OrdersEntity;
import com.kelvem.saas.workbanch.ontology.order.request.OrderPaymentReq;
import com.kelvem.saas.workbanch.ontology.order.request.OrdersReq;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author kelvem
 */
@RestController
@RequestMapping("/order")
public class OrdersController extends BaseController {

    @RequestMapping("/create")
    public String create(@RequestParam OrdersReq order) {
        super.trigger(OrdersEntity.class, OrderEventEnum.order_create.getEventCode(), order);
        return "create";
    }
    
    @RequestMapping("/payment")
    public String payment(@RequestParam OrderPaymentReq payment) {
        super.trigger(OrdersEntity.class, OrderEventEnum.order_payment.getEventCode(), payment);
        return "payment";
    }
    
    @RequestMapping("/confirm")
    public String confirm(@RequestParam Long id) {
        super.trigger(OrdersEntity.class, OrderEventEnum.order_confirm.getEventCode(), id);
        return "confirm";
    }
    
    @RequestMapping("/purchase")
    public String purchase() {
        return "purchase";
    }
    
    @RequestMapping("/shipping")
    public String shipping() {
        return "shipping";
    }
    
    @RequestMapping("/received")
    public String received() {
        return "received";
    }
    
    @RequestMapping("/directShipping")
    public String directShipping() {
        return "directShipping";
    }
    
}
